/*------------------------------------------------------------------------------------------------\
| Horrible X-Wing game by Steven Haber
| st_haber@hotmail.com
|
| Entity.h: contains the entity class, which is a base class for the player and enemy classes
|	(also in this file)
\------------------------------------------------------------------------------------------------*/

#ifndef ENTITY_H
#define ENTITY_H

#include "xwing.h"

class Craft;
class Health;
class Layzar;
class Score;

class Entity
{
public:
	Entity();
	~Entity();

	void draw();
	int collisionCheck(Craft *craft);
	void drawLayzars(float delta);

protected:
	int mLayzarOffsetX;
	int mLayzarOffsetY;

	sf::RenderWindow *mOut;
	sf::Sprite mLayzarSprite;
	sf::Clock mTimer;

	Craft *mCraft;
	Sound *mSounds;
	Layzar *mLayzars[NUMBERLAYZARS];
};


//Player class derived from Entity
class Player: public Entity
{
public:
	Player(int playerNumber, sf::Sprite *sprites[], int offsetX, int offsetY, sf::RenderWindow *out, Sound *sounds);
	
	void input(float delta);
	void die();
	bool hurt(int amount);
	void score(int value);

	void drawHealth();
	void drawScore();

	Craft *getCraft();

private:
	int mPlayerNumber;

	Score *mScore;
	Health *mHealth;

	void newLayzar();
};


//Enemy class derived from Entity
class Enemy: public Entity
{
	friend class Ai;

public:
	Enemy(sf::Sprite *craftSprite, int offsetX, int offsetY, sf::RenderWindow *out, sf::Sprite *layzarSprite, float initialX, int maxHealth,  Sound *sounds);
	
	void input(float delta, bool up, bool down, bool left, bool right, bool fire);
	bool hurt(int amount);
	void kill();

	Craft *getCraft();

private:
	int mHealth;
	bool mDying;
	bool mDead;

	void newLayzar();
};

#endif